<?php
/**
 * Created by PhpStorm.
 * User: 熊峰
 * Date: 2018/10/9
 * Time: 14:19
 */
//引用核心库文件
include_once "smarty-3.1.33/libs/Smarty.class.php";

//实例化模板引擎对象
$smarty=new Smarty();
//编译后的文件目录
$smarty->setCompileDir("smarty/compile");
//缓存目录
$smarty->setCacheDir("samarty/cache");
//配置文件
$smarty->setConfigDir("samarty/config");
//模板文件 专门存放HTML文件
$smarty->setTemplateDir("samarty/template");
//设置一个变量给页面
$smarty->assign("username","李四");
//设置一个数组给页面
$arr1=["a","b","c"];
$arr2=["a"=>1,"b"=>2,"c"=>3];

$smarty->assign("arr1",$arr1);
$smarty->assign("arr2",$arr2);
//渲染页面
$smarty->display("Text.html");